/**
 * Copyright (c) [2025] [AGIROS] 
 * [travoddsgen] is licensed under Mulan PSL v2. 
 * You can use this software according to the terms and conditions of the Mulan PSL v2. 
 * You may obtain a copy of Mulan PSL v2 at: 
 *          http://license.coscl.org.cn/MulanPSL2 
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 
 * See the Mulan PSL v2 for more details.
 */ 

#ifndef cpplangdeserializevisitor_h__
#define cpplangdeserializevisitor_h__

#include "FileGenVisitor.h"
#include "CppLangTypeNameVisitor.h"

class CppLangDeserializeVisitor : public FileGenVisitor {
public:
    CppLangDeserializeVisitor(CppLangTypeNameVisitor* typeNameVisitor);
    void visit(BaseTypeNode& node) override;
    void visit(SequenceTypeNode& node) override;
    void visit(StringTypeNode& node) override;
    void visit(WideStringTypeNode& node) override;
    void visit(FixedPtTypeNode& node) override;
    void visit(MapTypeNode& node) override;
    void visit(StructDefNode& node) override;
    void visit(MemberNode& node) override;
    void visit(ListNode<FixedArraySizeNode*>& node) override;
    void visit(FixedArraySizeNode& node) override;
    void visit(UnionDefNode& node) override;
    void visit(CaseNode& node) override;
    void visit(CaseLabelNode& node) override;
    void visit(EnumDclNode& node) override;
    void visit(ScopedNameNode& node) override;
    const std::string& getContent() const { return content_; }
protected:
    void visitPlCdr(ASTNode* node, const std::string& idStr);
protected:
    std::string memberName_;
    TypeSpecNode* memberType_;
    bool isArray_;
    bool plainCdrMode_;
    CppLangTypeNameVisitor* typeNameVisitor_;
    std::map<std::string, unsigned int> generatedTypeNames;
    bool isCppLangTypeSupport_;
};

#endif // cpplangdeserializevisitor_h__